package com.lyx.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.lyx.common.vo.R;
import com.lyx.server.dao.SmsLogDao;
import com.lyx.server.entity.SmsLog;
import com.lyx.server.service.SmsLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * --- Be Humble and Hungry ---
 *
 * @author McMeloxD
 * @date 2024/8/12
 * @desc
 */
@Service("smsLogService")
public class SmsLogServiceImpl implements SmsLogService {
    @Resource
    private SmsLogDao dao;

    @Override
    public R queryByPhone(String phone) {
        // 根据手机号查询短信记录,按发送时间降序排序
        return R.ok(dao.selectList(new LambdaQueryWrapper<SmsLog>().like(SmsLog::getPhone, phone).orderByDesc(SmsLog::getCreateTime)));
    }
}
